import uuid
from typing import Optional
from typing_extensions import TypedDict

from langgraph.checkpoint.memory import MemorySaver
from langgraph.constants import START
from langgraph.graph import StateGraph
from langgraph.types import interrupt, Command

def stream_data():
    # 模拟一个生成器函数，返回一些数据块
    for i in range(5):
        yield f"data_chunk_{i}"

# 假设 graph 对象有一个 stream 方法，返回上述生成器
class Graph:
    def stream(self, data_dict, config):
        return stream_data()

# 配置信息
config = {"some_config": "value"}

# 创建 graph 对象
graph = Graph()

# 流式获取数据并打印每个数据块
print("【Step 1: 触发中断】")
for chunk in graph.stream({"foo": "abc"}, config):
    print(chunk)



